﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OracleClient;
public partial class changyong_addwuliu : System.Web.UI.Page
{
    OracleConnection con = new OracleConnection("Data Source=orcl;Persist Security Info=True;User ID=booksale;Password=Qwertyuiop1;Unicode=True");
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        string sql = "insert into booksale.deliver_goods(图书编号,图书名称,发货时间,快递,用户) values('" + booknum.Text + "','" + bookname.Text + "',to_date('" + bookauthor.Text + "','yyyy-mm-dd'),'"+ bookpub.Text +"','"+ date.Text +"')";

        OracleCommand com = new OracleCommand(sql, con);

        if (con.State.Equals(ConnectionState.Closed))
        { con.Open(); }
        if (Convert.ToInt32(com.ExecuteNonQuery()) > 0)
        { Response.Write("<script language=javascript>alert('添加成功')</script>"); }
        else
        { Response.Write("<script language=javascript>alert('添加失败')</script>"); }
        if (con.State.Equals(ConnectionState.Open))
        { con.Close(); }
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        booknum.Text = bookname.Text = bookauthor.Text = bookpub.Text = date.Text = " ";
    }
  
}